<template>
	<!-- m-snv01 -->
	<div class="m-snv01">
		<ul class="ul-snv01">
			<li
				v-for="(item,index) of snv"
				:key="index"
			>
				<div class="v1"><i :class="['icon','iconfont',item.icon]"></i>{{ item.title }}</div>
				<dl>
					<dd
						v-for="(item1,index1) of item.list"
						:key="index1"
						:class="{'active': current == item1.index}"
						@click="makeActive(item1.to,item1.index)"
					>
						{{ item1.title }}
					</dd>
				</dl>
			</li>
		</ul>
	</div>
	<!-- m-snv01 end -->
</template>

<script>
	export default {
		name: "mySnv",
		data() {
			return {
				current: 0
			}
		},
		props: {
			snv: {
				type: Array,
				default: function(){
					return [
						{
							title: "我的资产",
							icon: "icon-menu-assets",
							list: [
								{
									title: "我的资产",
									index: 0,
									to: {
										name: "myBalance"
									}
								}
							]
						},
						{
							title: "资金账户",
							icon: "icon-menu-wallet",
							list: [
								{
									title: "资金账户",
									index: 1,
									to: {
										name: "myWallet"
									}
								},
								{
									title: "充币",
									index: 2,
									to: {
										name: ""
									}
								},
								{
									title: "提币",
									index: 3,
									to: {
										name: ""
									}
								},
								{
									title: "资金划转",
									index: 4,
									to: {
										name: ""
									}
								}
							]
						},
						{
							title: "法币账户",
							icon: "icon-menu-transaction",
							list: [
								{
									title: "币币/杠杆账户",
									index: 5,
									to: {
										name: ""
									}
								}
							]
						}
					]	
				},
				required: false
			}
		},
		methods: {
			makeActive(to,index) {
				this.current = index;
				this.$emit('currentChange',index);
				if(to){
					this.goto(to);
				}
			},
			changeCurrent1(index){
				this.current = index;
			},
			goto(obj) {
				this.$router.push(obj);
			}
		}
	}
</script>
